<template>
    <div class="box">
        <div style="height: 20%;">
            <van-address-list v-model="chosenAddressId" :list="list" :disabled-list="disabledList" default-tag-text="默认"
            @add="onAdd" @edit="onEdit" add-button-text="提交订单" @click="addFun()" />
        </div>
        

        <van-cell-group inset>
            <van-cell title="支付时间" :value="detlle.create_time" />
            <van-cell title="用户名" :value="detlle.username" />
            <van-cell title="支付描述" :value="detlle.product_code" />
            <van-cell title="订单总价" :value="detlle.totalPrice" />
            <van-cell title="订单id" :value="detlle.orderId" />
            <button>待支付</button>

        </van-cell-group>

    </div>
</template>

<script setup>
import { ref } from 'vue'
import _ from "lodash"
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
let id = ref(route.query.orderId)
console.log(id);
import { getOrderApi,payApi } from '@/api/api'
let detlle = ref("")
const delFun = () => {
    getOrderApi(id.value).then(res => {
        detlle.value = res.data.data
    })
}
delFun()

const list = [
    {
        id: '1',
        name: '张三',
        tel: '13000000000',
        address: '浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室',
        isDefault: true,
    },
];


const addFun = _.debounce(() => {
    console.log(1);
    let obj=({
        orderId:'detlle.orderId',
        subject:'detlle.product_code',
        totalPrice:'detlle.totalPrice',

    })
    payApi(obj).then(res=>{
        window.open(res.data.data)
    })
}, 1000)

const onEdit = (item, index) => showToast('编辑地址:' + index);
</script>

<style lang="scss" scoped></style>